home *** CD-ROM | disk | FTP | other *** search
/ The Programmer Disk / The Programmer Disk (Microforum).iso / xpro / tutor / pro12 / prncheck.bas < prev    next >
BASIC Source File  |  1990-10-12  |  2KB  |  55 lines

  1. 10 'PRNCHECK.BAS - A program to print selected checks on the printer
  2. 20 'From the GW-BASIC Tutorial Series (GWBT04 homework from 09/15)
  3. 30 '
  4. 40 'A Reminder:  Our CHECKS.DAT format is as follows:
  5. 50 '
  6. 60 'CHECKNO     Six characters containing the check number
  7. 70 'CHECKDATE   Ten characters containing the check date (mm/dd/yyyy)
  8. 80 'CHECKPAIDTO Fifty characters containing the payor of the check
  9. 90 'CHECKAMOUNT Ten characters containing the amount of the check (nnnnnn.nn)
  10. 100 'CHECKMEMO  Forty characters containing the memorandum field
  11. 110 '
  12. 120 'What we need to do is get the desired starting and ending check numbers
  13. 130 'from the user, then check each record in order to see if it falls between
  14. 140 'the desired range and print it if so.
  15. 150 '
  16. 160 CLS
  17. 170 LOCATE 25,1,0
  18. 180 PRINT"PRNCHECK - Specify range of checks to print on the printer";
  19. 190 LOCATE 1,1,0
  20. 200 INPUT "What is the FIRST check number to print";STARTNUMBER
  21. 210 INPUT "What is the LAST check number to print";ENDNUMBER
  22. 220 PRINT
  23. 230 PRINT "Opening CHECKS.DAT file, please wait..."
  24. 240 'The following statement sets up your printer to print lines of any width
  25. 250 'without adding extra carriage returns.  If your printer is on the second
  26. 260 '
  27. 270 'LPT port (LPT2), change all the "LPT1:" statements to "LPT2:"
  28. 280 WIDTH "LPT1:",255
  29. 290 'This statement sets your printer up for condensed print mode
  30. 300 '
  31. 310 LPRINT CHR$(27);CHR$(15);
  32. 320 'Now that the printer is set up, let's dig into CHECKS.DAT and see what
  33. 330 'we can find to print...
  34. 340 '
  35. 350 OPEN "CHECKS.DAT" FOR INPUT AS #1
  36. 360 'Next, set up a loop (in this case, we'll use WHILE/WEND) to read in all
  37. 370 'the checks to see if any of them match the range we want to print...
  38. 380 '
  39. 390 WHILE NOT EOF(1)
  40. 400 LINE INPUT #1,CHECKDATA$
  41. 410 CHECKNUMBER$=LEFT$(CHECKDATA$,6)
  42. 420 CHECKNUMBER=VAL(CHECKNUMBER)
  43. 430 IF CHECKNUMBER > STARTNUMBER THEN IF CHECKNUMBER < ENDNUMBER THEN LPRINT CHECKDATA$
  44. 440 WEND
  45. 450 '
  46. 460 'Note that all of the statements between the WHILE and WEND will be repeated
  47. 470 'AS LONG AS the test (NOT EOF(1) [not end of file on #1] is true, that is,
  48. 480 'we are not at the end of the file.  When we reach the end of the file,
  49. 490 'the program continues on the NEXT line number following the WEND...
  50. 500 CLOSE #1
  51. 510 PRINT
  52. 520 PRINT "Check printing is finished!  Thank you for waiting."
  53. 530 END
  54. 540 'End of program - PRNCHECK.BAS from GWBT05 10/15/1990
  55.